<template>
  <span>
    {{ text }} &nbsp;
    <CloudCascader :options="options" @change="onChange">
      <a href="#">Change city</a>
    </CloudCascader>
  </span>
</template>

<script>
  export default {
    title: '8.可以自定义显示 ',
    subTitle: '切换按钮和结果分开。',
    data () {
      return {
        text: 'Unselect',
        options: [
          {
            value: 'zhejiang',
            label: 'Zhejiang',
            children: [
              {
                value: 'hangzhou',
                label: 'Hangzhou',
                children: [
                  {
                    value: 'xihu',
                    label: 'West Lake',
                  },
                ],
              },
            ],
          },
          {
            value: 'jiangsu',
            label: 'Jiangsu',
            children: [
              {
                value: 'nanjing',
                label: 'Nanjing',
                children: [
                  {
                    value: 'zhonghuamen',
                    label: 'Zhong Hua Men',
                  },
                ],
              },
            ],
          },
        ],
      }
    },
    methods: {
      onChange (value, selectedOptions) {
        this.text = selectedOptions.map(o => o.label).join(', ');
      },
    }
  }
</script>

<style lang="scss">
</style>